package com.haojiang.mh.widget

import android.content.Context
import android.util.AttributeSet
import android.widget.TextView
import com.haojiang.mh.R
import kotlinx.android.synthetic.main.item_sleep_info.view.*

/**
 * author: jerry
 * date: 21-3-2
 * email: superliu0911@gmail.com
 * des:
 */
class SleepInfoAvgItemView : BaseFrameLayout {
    constructor(context: Context) : super(context) {}
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    ) {}

    override fun layoutId(): Int {
        return R.layout.item_sleep_avg_info
    }

    override fun bindData() {}

    fun init(title:String, unit: String) {
        setTitleText(title)
        setUnitText(unit)
    }

    fun setTitleText(text: String){
        tv_sleep_title.text = text
    }

    fun setText(text: String){
        tv_sleep_value.text = text
    }

    fun setUnitText(unit: String){
        tv_sleep_unit.text = unit
    }

    fun getText():TextView {
        return tv_sleep_value
    }
}